﻿using System;
using System.Collections.Generic;
using Edge.Business.Domain.Application;
using Edge.Common.ComponentModel;
using Edge.Common.Services;
using Edge.WebCode;
using Shop.Business.Domain.Catalog;
using Shop.Business.Domain.Catalog.Parameter;
using Shop.Business.Domain.Customers;
using Shop.Business.Domain.Orders.Logic;

namespace Shop.Web
{
    public partial class ShopBase : BaseMaster
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            DataBind();
            string curPath = Page.Request.Url.AbsoluteUri.ToLower();
            liAbout.Attributes["class"] = "";
            liCatalog.Attributes["class"] = "";
            liContent.Attributes["class"] = "";
            liDelivery.Attributes["class"] = "";
            liLaw.Attributes["class"] = "";
            liOffice.Attributes["class"] = "";
            if (curPath.IndexOf("About.aspx".ToLower()) > 0)
            {
                liAbout.Attributes["class"] = "current";
            }
            else if (curPath.IndexOf("Law.aspx".ToLower()) > 0)
            {
                liLaw.Attributes["class"] = "current";
            }
            else if (curPath.IndexOf("Catalog.aspx".ToLower()) > 0)
            {
                liCatalog.Attributes["class"] = "current";
            }
            else if (curPath.IndexOf("Interest.aspx".ToLower()) > 0)
            {
                liContent.Attributes["class"] = "current";
            }
            else if (curPath.IndexOf("Delivery.aspx".ToLower()) > 0)
            {
                liDelivery.Attributes["class"] = "current";
            }
            else if (curPath.IndexOf("Discount.aspx".ToLower()) > 0)
            {
                liOffice.Attributes["class"] = "current";
            } 
            else
                liCatalog.Attributes["class"] = "current";
        }

        private void DataBind()
        {
//            ICollection<Category> categories = Locator.GetService<ICategoryManager>().GetCategories(null);
//            ICollection<NavigationItem> items = Locator.GetService<ICategoryManager>().ConvertToNavigation(categories);
//            lmCategory.DataSourse = items;
//            items = Locator.GetService<IBrandManager>().ConvertToNavigation();
//            lmBrands.DataSourse = items;
//            lmParameter.DataSourse = Locator.GetService<IParameterManager>().ConvertToNavigation();
        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            Response.Redirect("Catalog.aspx?keyword=" + tbSearch.Text);
        }
    }
}
